package game.game.network.cmd;

import json.JSONObject;
import entity.Context;
import game.engine.network.client.IControllerClient;
import game.engine.network.cmd.CmdServer;
import game.engine.network.cmd.Command;
import game.engine.network.cmd.EnumCommand;
import game.game.network.client.IGameClientController;

public class CmdSReturnContext extends CmdServer
{

	protected Context _context;

	public CmdSReturnContext(JSONObject pObject)
	{
		super( pObject );
	}

	public CmdSReturnContext(Context pContext)
	{
		super( EnumCommand.CMD_SERV_RETURN_CONTEXT );
		addParam( Command.KEY_USERCODE , pContext.getUserCode() );
		addParam( Command.KEY_USERID , pContext.getUserId() );
	}

	public Integer getUserId()
	{
		return (Integer) getParam( Command.KEY_USERID );// TODO
	}

	public Context getContext()
	{
		return new Context( (Integer) getParam( Command.KEY_USERID ), (String) getParam( Command.KEY_USERCODE ) );
	}

	@Override
	public void execute( IControllerClient pController )
	{
		((IGameClientController)pController).execute( this );

	}

}
